<?php
/**
 * Контроллер универсальных каталогов
 * 
 * @category Phorm
 * @package Controller_Module_Default
 * @name /application/default/controllers/ItemsController.php
 * @copyright phorm.ru
 * @since 10.09.2010
 * @author vladimir@kachalov.net
 * @todo Удалить
 */

	class Phorm_Controller_Module_Default_Items extends Phorm_Controller_Controller {
		
	/**
	 * Экземпляр класса универсальных каталогов
	 * @var Phorm_Resource_Items
	 */
	private $Items;
	
	
	/**
	 * Предиспетчер
	 * 
	 * @return void
	 */
	
	public function preDispatch() {
		
		$this->Items = new Phorm_Resource_Items();
		
	}
		
		
	/**
	 * Информация о продукте
	 * 
	 * @return null
	 */
		
	public function viewAction() {
			
		if(isset($this->_params["resourceinfo"]["resourceid"]) && $ItemInfo=$this->Items->getItemInfo($this->_params["resourceinfo"]["resourceid"])) {
				
			$ItemInfo += $this->_params["resourceinfo"];
			
			if(!empty($ItemInfo["seotitle"])) $this->view->assign("Title",$ItemInfo["seotitle"]);
			if(!empty($ItemInfo["seodescription"])) $this->view->assign("Description",$ItemInfo["seodescription"]);
			if(!empty($ItemInfo["seokeywords"])) $this->view->assign("Keywords",$ItemInfo["seokeywords"]);
				
			$this->view->assign("Header",$ItemInfo["resourcename"]);
				
			$this->view->assign("ItemInfo",$ItemInfo);
				
		} else {
				
			return $this->_forward("notfound","error","default",array("action"=>"notfound","controller"=>"error","module"=>"default"));
				
		}
						
	}
		
}